# -*- coding: utf-8 -*-
# @Time : 2025/2/27 10:16
# @Author : debbyszhang
# @File : new_relay.py
# @desc :
import allure
from playwright.sync_api import expect

from libs.tools import utils
from pageObject.relay_list_page import RelayListPage


@allure.feature("新建中继网关")
class TestNewRelay:

    def test_new_relay(self, page):
        relay_page = RelayListPage(page)
        gateway_name = 're-' + utils.getCurrentMintus()
        gateway_id = '0-' + utils.getCurrentMintus()
        relay_page.new_gateway(gateway_id, gateway_name)
        t = relay_page.page.locator("#tea-message-root div").inner_text()
        print(t)  # '创建成功'
        assert t == '创建成功'
        # print(page.get_by_role("cell", name=gateway_name).locator("div").text_content())
        expect(page.get_by_role("cell", name=gateway_name).locator("div")).to_be_visible()
